﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="CloudMLDemo.Controllers" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <meta name="viewport" content="width=device-width" />
    <title>Validation Result</title>
</head>
<body>
    <div>
        <% var controller = ViewContext.Controller as HomeController; %>
        <p>First <% Response.Write(controller.DataTable.Rows.Count()); %> records from your query:</p>
        <table>
            <tr>
                <%
                    foreach (var column in controller.DataTable.ColumnNames)
                    {

                        Response.Write(@"<th>");
                        Response.Write(column);
                        Response.Write(@"</th>");
                    }
                %>
            </tr>

            <%
                foreach (var row in controller.DataTable.Rows)
                {
                    Response.Write("<tr>");
                    foreach (var entry in row)
                    {
                        Response.Write("<td>");
                        Response.Write(entry);
                        Response.Write("</td>");
                    }
                    Response.Write("</tr>");
                }
            %>
        </table>
        <p>
            RRS Input Schema:
        </p>
        <table>
            <tr>


                <%
                    foreach (var name in controller.RrsInputParameters)
                    {
                        Response.Write("<td>");
                        Response.Write(name);
                        Response.Write("</td>");
                    }
                %>
            </tr>
        </table>

        <p>
            Validation Message:
        </p>
        <p>
            <%
                Response.Write(ViewContext.ViewData["ValidationMessage"]); %>
        </p>
        <form method="POST" action="/Home/Preview">
            <input type="hidden" name="SqlConnectionString" value="<% Response.Write(this.ViewData["SqlConnectionString"]);%>">
            <input type="hidden" name="Query" value="<% Response.Write(this.ViewData["Query"]);%>">
            <input type="hidden" name="WSEndpoint" value="<% Response.Write(controller.WebServiceEndPoint);%>">
            <input type="hidden" name="WSKey" value="<% Response.Write(controller.WebServiceKey);%>">
            <%
                if (controller.IsSuccessful)
                {
                    Response.Write("<input type=\"submit\" value=\"Preview\">");
                } %>
        </form>
    </div>
</body>
</html>
